package com.scheduling.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.scheduling.common.annotation.Log;
import com.scheduling.common.core.controller.BaseController;
import com.scheduling.common.core.domain.AjaxResult;
import com.scheduling.common.enums.BusinessType;
import com.scheduling.system.domain.Schedulingtools;
import com.scheduling.system.service.ISchedulingtoolsService;
import com.scheduling.common.utils.poi.ExcelUtil;
import com.scheduling.common.core.page.TableDataInfo;

/**
 * 其他工具Controller
 * 
 * @author mj
 * @date 2025-05-07
 */
@RestController
@RequestMapping("/system/schedulingtools")
public class SchedulingtoolsController extends BaseController
{
    @Autowired
    private ISchedulingtoolsService schedulingtoolsService;

    /**
     * 查询其他工具列表
     */
    @PreAuthorize("@ss.hasPermi('system:schedulingtools:list')")
    @GetMapping("/list")
    public TableDataInfo list(Schedulingtools schedulingtools)
    {
        startPage();
        List<Schedulingtools> list = schedulingtoolsService.selectSchedulingtoolsList(schedulingtools);
        return getDataTable(list);
    }

    /**
     * 导出其他工具列表
     */
    @PreAuthorize("@ss.hasPermi('system:schedulingtools:export')")
    @Log(title = "其他工具", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Schedulingtools schedulingtools)
    {
        List<Schedulingtools> list = schedulingtoolsService.selectSchedulingtoolsList(schedulingtools);
        ExcelUtil<Schedulingtools> util = new ExcelUtil<Schedulingtools>(Schedulingtools.class);
        util.exportExcel(response, list, "其他工具数据");
    }

    /**
     * 获取其他工具详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:schedulingtools:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(schedulingtoolsService.selectSchedulingtoolsById(id));
    }

    /**
     * 新增其他工具
     */
    @PreAuthorize("@ss.hasPermi('system:schedulingtools:add')")
    @Log(title = "其他工具", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Schedulingtools schedulingtools)
    {
        return toAjax(schedulingtoolsService.insertSchedulingtools(schedulingtools));
    }

    /**
     * 修改其他工具
     */
    @PreAuthorize("@ss.hasPermi('system:schedulingtools:edit')")
    @Log(title = "其他工具", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Schedulingtools schedulingtools)
    {
        return toAjax(schedulingtoolsService.updateSchedulingtools(schedulingtools));
    }

    /**
     * 删除其他工具
     */
    @PreAuthorize("@ss.hasPermi('system:schedulingtools:remove')")
    @Log(title = "其他工具", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(schedulingtoolsService.deleteSchedulingtoolsByIds(ids));
    }
}
